<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models\RandomCheck;

use App\Models\Projects\Product;
use Carbon\Carbon;
use App\Models\Eloquent;
use App\Models\Meimei\Traits\SignOssUrlTrait;
use App\Models\Meimei\Traits\ExplodeTrait;

/**
 * Class QtpRandomCheckLog
 *
 * @property int $id
 * @property int $product_id
 * @property string $content
 * @property string $remark
 * @property string $modules
 * @property string $note
 * @property string $res
 * @property string $created_adminer
 * @property string $updated_adminer
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 *
 * @package App\Models
 */
class RandomCheckLog extends Eloquent
{
    use ExplodeTrait;
    use SignOssUrlTrait;
    protected $explode_imgs = ['info_imgs']; // 多图
    protected $explode = ['modules'];

    protected $table = 'random_check_logs';

    protected $casts = [
		'product_id' => 'int'
	];

	protected $fillable = [
		'product_id',
		'content',
		'remark',
		'note',
		'res',
        'modules',
        'info_imgs',
		'created_adminer',
		'updated_adminer'
	];

    public static $fillables = [
        'product_id' => '产品.ID',
        'content' => '巡检内容',
        'remark' => '巡检备注',
        'note' => '巡检说明',
        'res' => '巡检结果',
        'info_imgs' => '图片说明',
        'modules' => '巡检模块',
        'created_adminer' => '巡检人',
        'updated_adminer' => '更新人',
    ];

    public function label()
    {
        $this->product_name = Product::find($this->product_id)->name ?? '';
        return $this;
    }


}
